﻿using System;
using System.Xml;
using Sherwood.Configuration;
using Sherwood.Content.DO.Model;
using Sherwood.Content.Tests;
using Sherwood.Samples.ArticleMeta;

namespace Sherwood.Content.DO.Tests
{
    public class TestDataCreator : IXmlConfigurable
    {
        public void Configure(XmlReader config)
        {
            using(var dataSession = DependencyInjection.Resolve<IDataSessionProvider>().CreateScope())
            {
                var client = new Client("SampleClient", "My test client")
                                 {
                                     PublicKey = SampleClient.PublicKey
                                 };
                var record = new Record(client, "1", "Test Record");
                var meta = new ArticleMeta(record, client);
                meta.Author = "Joe Smith";
                meta.PublishDate = new DateTime(2010, 4, 1);

                dataSession.Complete();
            }
        }
    }
}